﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sample.Core
{
    public class Settings
    {
        private static readonly Lazy<Settings> _instance = new Lazy<Settings>(() => new Settings());

        public static Settings Instance => _instance.Value;

        public IConfigurationRoot Configuration { get; }

        private Settings()
        {
            var builder = new ConfigurationBuilder()
                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            Configuration = builder.Build();
        }

        /// <summary>
        /// Windows ServiceName
        /// </summary>
        public string ServiceName => Configuration["topshelf.server.serviceName"];
        /// <summary>
        /// Windows ServiceDisplayName
        /// </summary>
        public string ServiceDisplayName => Configuration["topshelf.server.serviceDisplayName"];
        /// <summary>
        /// Windows ServiceDescription
        /// </summary>
        public string ServiceDescription => Configuration["topshelf.server.serviceDescription"];
    }
}
